package com.dks.controller;

import com.dks.repository.IInvitationRecordRepository;
import com.dks.result.Result;
import com.dks.result.ResultInfo;
import com.dks.result.ResultModel;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("invitation-record")
@RestController
public class InvitationRecordController{

    @Autowired
    private IInvitationRecordRepository invitationRecordRepository;


    /**
     * @Author: Ah Nan
     * @Description: 获取邀请记录列表
     * @Date: 9:52 2020/4/23
     * @Modificd By:
     * @Param: invitedUsersId 邀请人id
     * @Param: pageNum 页码
     * @Param: pageSize 条数
     * @return:
     * @throw: 请描述异常信息
     */
    @GetMapping("get-invitation-reward-list")
    public ResultModel<Object> getInvitationRewardList(Integer invitedUsersId, Integer pageNum, Integer pageSize) {

        if (null == pageNum) {
            return Result.makeResult(ResultInfo.ERR_PARAM_NULL, "pageNum");
        }
        if (null == pageSize) {
            return Result.makeResult(ResultInfo.ERR_PARAM_NULL, "pageSize");
        }
        if (null == invitedUsersId) {
            return Result.makeResult(ResultInfo.ERR_PARAM_NULL, "parentId");
        }
        return invitationRecordRepository.getInvitationRewardList(invitedUsersId,pageNum,pageSize);
    }
}
